<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<%@include file="../../common/include_list_head.jsp" %>

		<script type="text/javascript"
			src="${basePath }/resources/js/p2pMessage.js"></script>
		<script type="text/javascript" src="${basePath }/component/datepicker/WdatePicker.js"></script>
			
		<script type="text/javascript">

	function jsrInfo(userid){
		openWindow('${basePath }/usercenter/user/'+userid);
	}
	
	function removeAll(str){
		document.getElementById("inp").style.display="";
		if(document.getElementById('mydate').value==''){
			document.getElementById('mydate').focus();
		}else{
			var s = str;
			removet(s);
		}
	}
	function removet(str){
		var mydate = document.getElementById('mydate').value;
		var fszt = document.getElementById('fszt').value;
		if(fszt==null){
			fszt = '-1';
		}
		var conf = window.confirm("您确定要删除"+mydate+"前的记录吗？");
		if(conf==true){
				var url_bak = document.forms[0].action;
				var url = actionName + "-remove."+uri_suffix;
				var queryType=str;
				jQuery.post(url,
				       { czsj: mydate, queryType: queryType, fszt: fszt, reqtime: (new Date()).getTime() },
				       function(data){
							document.forms[0].action = url_bak;//还原URL，防止点查询按钮却执行删除！
							document.forms[0].submit();
				       }
				);
		}else{
			document.getElementById('mydate').value = '';
			document.getElementById("inp").style.display="none";
		}
	}	
	function openPage(uri){
		if(uri.indexOf('xxzt=0')!=-1){
			openWindow(uri,400,250);
		}else{
			openWindow(uri,550,250);
		}
	}
	function openPageModify(uri){
		openWindow(uri,850,300);
	}
	function openPageMsgbody(uri,wid){
		openWindow(uri,550,300);
		changeMsgState(wid);
	}
	
	</script>
	</head>
	
	<body>
    <div id="scrollContent">
		<s:if
			test="actionErrors.size()>0 || actionMessages.size()>0 || fieldErrors.size()>0">
			<div id="SystemErrorMessage">
				<s:actionerror />
				<s:actionmessage />
				<s:fielderror />
			</div>
		</s:if>
		
		<div class="box_tool_mid padding_right5">
			<div class="center">
				<div class="left">
					<div class="right">
						<div class="padding_top8 padding_left10">
							<table>
								<tr >
						<s:form theme="simple" name="ysform">
						    <s:hidden name="pager.formname" value="ysform"/>
						    <s:hidden name="pager.currentPageno" id="yspager_currentPageno"/>
							<s:hidden name="queryType" id="queryType"/>
							<s:hidden name="fszt" value="%{#parameters.fs[0]}" id="fszt"/>
							<s:hidden name="fs" value="%{#parameters.fs[0]}" id="fs"/>

												<td align="right" nowrap="nowrap">
													&nbsp;消息标题：
												</td>
												<td align="left">
													<s:textfield name="tsysMessage.xxbt" id="yxbm"
														maxlength="50" size="30" />
												</td>

						</s:form>
									<td><button type="button" onclick="super_doSearch()"><span class="icon_find">查询</span></button>
										<button type="button" onclick="doreset();"><span class="icon_recycle"> 重置 </span></button></td>
								</tr>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
		
		<div id="userRoleMenuButton">
			<s:if test="#queryType==2">
				<button onclick="replyMsg()" type="button"><span class="icon_add">回复</span></button>
				<button onclick="removeAll('2')" type="button"><span class="icon_list">删除指定日期前的收件箱消息</span></button>
			</s:if>
			<s:elseif test="#queryType==1">
				<button onclick="writeMsg()" type="button"><span class="icon_add">写消息</span></button>
				<button onclick="removeAll('1')" type="button"><span class="icon_list">删除指定日期前的发件箱消息</span></button>
			</s:elseif>
			
			<s:property value="userRoleMenuButton" escape="false"/>
			
			<div id="inp" style="display:none" align="left" width="160px">
										指定日期：
											<s:if test="#queryType==2">
												<s:textfield id="mydate" name="mydate" maxlength="20" size="10" onchange="removet('2')" onfocus="WdatePicker({startDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})"/>
											</s:if>
											<s:elseif test="#queryType==1">
												<s:textfield id="mydate" name="mydate" maxlength="20" size="10" onchange="removet('1')" onfocus="WdatePicker({startDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})"/>
											</s:elseif>
			</div>
		</div>
		
		<div>
			<table class="tableStyle" headFixMode="true"
				useMultColor="false" useCheckBox="false">
				<tr>
					<th width="10%">
																	消息类型
																</th>
																<s:if test="#queryType==2">
																	<th width="10%">
																		发送者
																	</th>
																</s:if>
																<s:elseif test="#queryType==1">
																	<th width="10%">
																			接收者
																	</th>
																</s:elseif>
																<th width="22%">
																	消息标题
																</th>
																<th width="10%">
																	发送时间
																</th>
																<th width="10%">
																	操作
																</th>

										</tr>
						 	<s:iterator value="resultData">
										<tr>
													<td>
																		<s:property value="xxlx" />
																	</td>
																	<s:if test="#queryType==2">
																		<td>
																			<a
																				href="javascript:jsrInfo('<s:property value="xxfsr"/>')""><font
																				color="blue"><s:property value="xxfsrName" /> </font> </a>
																		</td>
																	</s:if>
																	<s:elseif test="#queryType==1">
																		<td>
																			<s:property value="xxjsrName" />
																			<s:if test="xxlx=='全站通知'">群发</s:if>
																		</td>
																	</s:elseif>
																	<td id="msg_title<s:property value="wid"/>" <s:if test="xxzt==0">style="font-weight: bold"</s:if>>
																		<s:property value="xxbt" />
																	</td>
																	<td>
																		<s:date format="yyyy-MM-dd HH:mm" name="xxfssj" />
																	</td>
																	<td>
																	  <s:if test="#queryType==1">
																		<span> 	
																			<font color="blue">
																				<a id="switchShow<s:property value="wid"/>"
																				href="javaScript:readMsg('<s:property value="wid"/>','<s:property value="receiverWid"/>',false)">查看</a>
																			</font> 
																		</span>
																	  </s:if>
																	  <s:else>
																		<span> 
																			<font color="blue">
																				<a id="switchShow<s:property value="wid"/>"
																				href="javaScript:readMsg('<s:property value="wid"/>','<s:property value="receiverWid"/>',<s:property value="xxzt==0"/>)">查看</a>
																			</font> 
																		</span>
																	  </s:else>
																		<span id="msg<s:property value="wid"/>"
																			style="display:none;text-align:left;width:100%;height:60;word-wrap: break-word; word-break: break-all;">
																			&nbsp;&nbsp;
																			<s:if test="xxlx==101">
																				<s:property value="xxnr" escape="false" /></br></br>
																			</s:if>
																			<s:else>
																				<s:property value="xxnr" escape="true" /></br></br>
																			</s:else>
																		    <s:if test="fjm != null">
																		    	<b>附件：</b><a href="../system/message-download.action?aId=<s:property value='wid'/>&pathStr=<s:property value='fjm'/>">
																		    	<FONT color="blue"><s:property value='fjm'/></FONT></a>
																		    </s:if>
																		</span>
																		<s:if test="#queryType==2">
																			<a
																				href="javaScript:replyMsg('<s:property value="xxfsr"/>','<s:property value="wid"/>','<s:property value="receiverWid"/>')"><font
																				color="blue">回复</font></a>
																			<a href="javaScript:submitRemove('<s:property value="receiverWid"/>','xxjsr')"><font color="blue">删除</font> </a>
																		</s:if>
																		<s:else>
																			<a href="javaScript:submitRemove('<s:property value="wid"/>','xxfsr')"><font color="blue">删除</font> </a>
																		</s:else>
																	</td>
							</tr>

					</s:iterator>
			</table>
		</div>

		<div style="height: 45px;">
			<div id="pagelist" style="display: none">
	  			<s:property value="pager.postToolBar" escape="false"/>
	  		</div>
	
			<div class="clear"></div>
		</div>
	</div>

	</body>
</html>

